package org.cfg;

import com.sojoys.artifact.build.data.base.BaseCfg;
import java.util.List;
import com.sojoys.artifact.tools.ToolMap;
import com.sojoys.artifact.tools.ToolCopy;
import com.sojoys.artifact.factory.bytebuff.IByteBuff;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.sojoys.artifact.constant.DataModelKeyEnum;
/**
 * 功能道具
 */
public class RoomCfg extends BaseCfg<RoomCfg> implements org.base.BaseGoods{

	/**
	 * 数据库表名称
	 */
	public static final String TABLE_NAME = "room";
	/**
	 * 完整类名称
	 */
	public static final String CLASS_NAME = "org.cfg.RoomCfg"; 
	/**
	 * 字段个数
	 */
	public static final int COLUMN_COUNT= 22;
	/**
	 * 数据库源字段注释
	 */
	public static final String[] SOURCE_COLUMN_REMARKS = new String[]{"","名字","名称文字ID","道具类型","子类型","小类型","背包类型","排序索引","星级","品质","出售收益","总上限","单格上限","达总上限转换","交易收益","描述","描述文字ID","价值(策划查看)","是否支持叠加","解锁消耗","影响","属于指定精灵，精灵id",};
	/**
	 * 数据库源字段名字
	 */
	public static final String[] SOURCE_COLUMN_NAMES = new String[]{"id","name","nameTextId","superType","subType","smallType","bagType","order","star","quality","sellProfit","totalMax","gridMax","convertMax","dealProfit","des","desTextId","cost","pileUp","unlockCost","effect","belongToRole",};
	/**
	 * 拼音字段名字
	 */
	public static final String[] PINGYING_COLUMN_NAMES = new String[]{"id","name","nameTextId","superType","subType","smallType","bagType","order","star","quality","sellProfit","totalMax","gridMax","convertMax","dealProfit","des","desTextId","cost","pileUp","unlockCost","effect","belongToRole",};
	/**
	 * HashCode字段名字
	 */
	public static final Integer[] HASHCODE_COLUMN_NAMES = new Integer[]{3355,3373707,-732903021,-332841643,-1868521062,-1623212831,-344179870,106006350,3540562,651215103,-283397066,-849912960,287347774,2043236017,673261008,99346,1058886106,3059661,-988215443,-859913935,-1306084975,-1981741136,};
	/**
	 * 字段基本类型
	 */
	public static final String[] COLUMN_BASICTYPES = new String[]{"int","String","int","int","int","int","int","int","int","int","Map","int","int","Map","Map","String","int","String","boolean","Map","List","int",};
	/**
	 * 字段引用类型
	 */
	public static final Class[] COLUMN_CLASSTYPES = new Class[]{Integer.class,String.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Integer.class,Map.class,Integer.class,Integer.class,Map.class,Map.class,String.class,Integer.class,String.class,Boolean.class,Map.class,List.class,Integer.class,};
	
	/**
	 * id
	 */
	private int id;
	
	/**
	 * 名字
	 */
	private String name;
	
	/**
	 * 名称文字ID
	 */
	private int nameTextId;
	
	/**
	 * 道具类型
	 */
	private int superType;
	
	/**
	 * 子类型
	 */
	private int subType;
	
	/**
	 * 小类型
	 */
	private int smallType;
	
	/**
	 * 背包类型
	 */
	private int bagType;
	
	/**
	 * 排序索引
	 */
	private int order;
	
	/**
	 * 星级
	 */
	private int star;
	
	/**
	 * 品质
	 */
	private int quality;
	
	/**
	 * 出售收益
	 */
	private Map sellProfit;
	
	/**
	 * 总上限
	 */
	private int totalMax;
	
	/**
	 * 单格上限
	 */
	private int gridMax;
	
	/**
	 * 达总上限转换
	 */
	private Map convertMax;
	
	/**
	 * 交易收益
	 */
	private Map dealProfit;
	
	/**
	 * 描述
	 */
	private String des;
	
	/**
	 * 描述文字ID
	 */
	private int desTextId;
	
	/**
	 * 价值(策划查看)
	 */
	private String cost;
	
	/**
	 * 是否支持叠加
	 */
	private boolean pileUp;
	
	/**
	 * 解锁消耗
	 */
	private Map unlockCost;
	
	/**
	 * 影响
	 */
	private List effect;
	
	/**
	 * 属于指定精灵，精灵id
	 */
	private int belongToRole;
	
	
	
	public static RoomCfg builder() {
		RoomCfg roomCfg = new RoomCfg();
		return roomCfg;
	}
	
	/**
	 * id
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * 名字
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * 名称文字ID
	 */
	public int getNameTextId() {
		return nameTextId;
	}
	
	/**
	 * 道具类型
	 */
	public int getSuperType() {
		return superType;
	}
	
	/**
	 * 子类型
	 */
	public int getSubType() {
		return subType;
	}
	
	/**
	 * 小类型
	 */
	public int getSmallType() {
		return smallType;
	}
	
	/**
	 * 背包类型
	 */
	public int getBagType() {
		return bagType;
	}
	
	/**
	 * 排序索引
	 */
	public int getOrder() {
		return order;
	}
	
	/**
	 * 星级
	 */
	public int getStar() {
		return star;
	}
	
	/**
	 * 品质
	 */
	public int getQuality() {
		return quality;
	}
	
	/**
	 * 出售收益
	 */
	public Map getSellProfit() {
		return sellProfit;
	}
	
	/**
	 * 总上限
	 */
	public int getTotalMax() {
		return totalMax;
	}
	
	/**
	 * 单格上限
	 */
	public int getGridMax() {
		return gridMax;
	}
	
	/**
	 * 达总上限转换
	 */
	public Map getConvertMax() {
		return convertMax;
	}
	
	/**
	 * 交易收益
	 */
	public Map getDealProfit() {
		return dealProfit;
	}
	
	/**
	 * 描述
	 */
	public String getDes() {
		return des;
	}
	
	/**
	 * 描述文字ID
	 */
	public int getDesTextId() {
		return desTextId;
	}
	
	/**
	 * 价值(策划查看)
	 */
	public String getCost() {
		return cost;
	}
	
	/**
	 * 是否支持叠加
	 */
	public boolean getPileUp() {
		return pileUp;
	}
	
	/**
	 * 解锁消耗
	 */
	public Map getUnlockCost() {
		return unlockCost;
	}
	
	/**
	 * 影响
	 */
	public List getEffect() {
		return effect;
	}
	
	/**
	 * 属于指定精灵，精灵id
	 */
	public int getBelongToRole() {
		return belongToRole;
	}
	
	
	protected Object[] getColumnNames(DataModelKeyEnum e){
		switch (e) {
		case SOURCE:
			return SOURCE_COLUMN_NAMES;
		case PINGYING:
			return PINGYING_COLUMN_NAMES;
		case HASHCODE:
			return HASHCODE_COLUMN_NAMES;
		case REMARKS:
			return SOURCE_COLUMN_REMARKS;
		default:
			return PINGYING_COLUMN_NAMES;
		}
	}
	
	protected String[] getBasicTypes(){
		return COLUMN_BASICTYPES;
	}
	
	protected Class[] getClassTypes(){
		return COLUMN_CLASSTYPES;
	}
	
	protected Object[] getColumeValues(){
		Object[] values = new Object[COLUMN_COUNT];
        values[0] = this.id;
        values[1] = this.name;
        values[2] = this.nameTextId;
        values[3] = this.superType;
        values[4] = this.subType;
        values[5] = this.smallType;
        values[6] = this.bagType;
        values[7] = this.order;
        values[8] = this.star;
        values[9] = this.quality;
        values[10] = this.sellProfit;
        values[11] = this.totalMax;
        values[12] = this.gridMax;
        values[13] = this.convertMax;
        values[14] = this.dealProfit;
        values[15] = this.des;
        values[16] = this.desTextId;
        values[17] = this.cost;
        values[18] = this.pileUp;
        values[19] = this.unlockCost;
        values[20] = this.effect;
        values[21] = this.belongToRole;
        return values;
	}
	
	protected RoomCfg createColumeValues(Object[] vals) {
		this.id = (int)vals[0];
		this.name = (String)vals[1];
		this.nameTextId = (int)vals[2];
		this.superType = (int)vals[3];
		this.subType = (int)vals[4];
		this.smallType = (int)vals[5];
		this.bagType = (int)vals[6];
		this.order = (int)vals[7];
		this.star = (int)vals[8];
		this.quality = (int)vals[9];
		this.sellProfit = (Map)vals[10];
		this.totalMax = (int)vals[11];
		this.gridMax = (int)vals[12];
		this.convertMax = (Map)vals[13];
		this.dealProfit = (Map)vals[14];
		this.des = (String)vals[15];
		this.desTextId = (int)vals[16];
		this.cost = (String)vals[17];
		this.pileUp = (boolean)vals[18];
		this.unlockCost = (Map)vals[19];
		this.effect = (List)vals[20];
		this.belongToRole = (int)vals[21];
		return this;
	}
	
	protected Map<Object, Object> toMap(Object[] keys,Map<Object, Object> map){
        map.put(keys[0], this.id);
        map.put(keys[1], this.name);
        map.put(keys[2], this.nameTextId);
        map.put(keys[3], this.superType);
        map.put(keys[4], this.subType);
        map.put(keys[5], this.smallType);
        map.put(keys[6], this.bagType);
        map.put(keys[7], this.order);
        map.put(keys[8], this.star);
        map.put(keys[9], this.quality);
        map.put(keys[10], this.sellProfit);
        map.put(keys[11], this.totalMax);
        map.put(keys[12], this.gridMax);
        map.put(keys[13], this.convertMax);
        map.put(keys[14], this.dealProfit);
        map.put(keys[15], this.des);
        map.put(keys[16], this.desTextId);
        map.put(keys[17], this.cost);
        map.put(keys[18], this.pileUp);
        map.put(keys[19], this.unlockCost);
        map.put(keys[20], this.effect);
        map.put(keys[21], this.belongToRole);
        return map;
    }
    
    protected RoomCfg createForMap(Object[] keys,Map map){
   		this.id = (int)map.get(keys[0]);
   		this.name = (String)map.get(keys[1]);
   		this.nameTextId = (int)map.get(keys[2]);
   		this.superType = (int)map.get(keys[3]);
   		this.subType = (int)map.get(keys[4]);
   		this.smallType = (int)map.get(keys[5]);
   		this.bagType = (int)map.get(keys[6]);
   		this.order = (int)map.get(keys[7]);
   		this.star = (int)map.get(keys[8]);
   		this.quality = (int)map.get(keys[9]);
   		this.sellProfit = (Map)map.get(keys[10]);
   		this.totalMax = (int)map.get(keys[11]);
   		this.gridMax = (int)map.get(keys[12]);
   		this.convertMax = (Map)map.get(keys[13]);
   		this.dealProfit = (Map)map.get(keys[14]);
   		this.des = (String)map.get(keys[15]);
   		this.desTextId = (int)map.get(keys[16]);
   		this.cost = (String)map.get(keys[17]);
   		this.pileUp = (boolean)map.get(keys[18]);
   		this.unlockCost = (Map)map.get(keys[19]);
   		this.effect = (List)map.get(keys[20]);
   		this.belongToRole = (int)map.get(keys[21]);
        return this;
    }
	
	
	protected JSONObject toJSONObject(Object[] keys,JSONObject obj){
        obj.put(keys[0], this.id);
        obj.put(keys[1], this.name);
        obj.put(keys[2], this.nameTextId);
        obj.put(keys[3], this.superType);
        obj.put(keys[4], this.subType);
        obj.put(keys[5], this.smallType);
        obj.put(keys[6], this.bagType);
        obj.put(keys[7], this.order);
        obj.put(keys[8], this.star);
        obj.put(keys[9], this.quality);
        obj.put(keys[10], this.sellProfit);
        obj.put(keys[11], this.totalMax);
        obj.put(keys[12], this.gridMax);
        obj.put(keys[13], this.convertMax);
        obj.put(keys[14], this.dealProfit);
        obj.put(keys[15], this.des);
        obj.put(keys[16], this.desTextId);
        obj.put(keys[17], this.cost);
        obj.put(keys[18], this.pileUp);
        obj.put(keys[19], this.unlockCost);
        obj.put(keys[20], this.effect);
        obj.put(keys[21], this.belongToRole);
        return obj;
    }
    
    protected RoomCfg createForJSONObject(Object[] keys,JSONObject obj){
	    this.id = obj.getIntValue(keys[0]);
	    this.name = obj.getString(keys[1]);
	    this.nameTextId = obj.getIntValue(keys[2]);
	    this.superType = obj.getIntValue(keys[3]);
	    this.subType = obj.getIntValue(keys[4]);
	    this.smallType = obj.getIntValue(keys[5]);
	    this.bagType = obj.getIntValue(keys[6]);
	    this.order = obj.getIntValue(keys[7]);
	    this.star = obj.getIntValue(keys[8]);
	    this.quality = obj.getIntValue(keys[9]);
		this.sellProfit = obj.getObject(keys[10],Map.class);
	    this.totalMax = obj.getIntValue(keys[11]);
	    this.gridMax = obj.getIntValue(keys[12]);
		this.convertMax = obj.getObject(keys[13],Map.class);
		this.dealProfit = obj.getObject(keys[14],Map.class);
	    this.des = obj.getString(keys[15]);
	    this.desTextId = obj.getIntValue(keys[16]);
	    this.cost = obj.getString(keys[17]);
	    this.pileUp = obj.getBooleanValue(keys[18]);
		this.unlockCost = obj.getObject(keys[19],Map.class);
		this.effect = obj.getObject(keys[20],List.class);
	    this.belongToRole = obj.getIntValue(keys[21]);
        return this;
    }
    
    protected void writeBytes(IByteBuff byteBuf){
	    byteBuf.writeInt(this.id);
	    byteBuf.writeString(this.name);
	    byteBuf.writeInt(this.nameTextId);
	    byteBuf.writeInt(this.superType);
	    byteBuf.writeInt(this.subType);
	    byteBuf.writeInt(this.smallType);
	    byteBuf.writeInt(this.bagType);
	    byteBuf.writeInt(this.order);
	    byteBuf.writeInt(this.star);
	    byteBuf.writeInt(this.quality);
	    byteBuf.writeObject(this.sellProfit);
	    byteBuf.writeInt(this.totalMax);
	    byteBuf.writeInt(this.gridMax);
	    byteBuf.writeObject(this.convertMax);
	    byteBuf.writeObject(this.dealProfit);
	    byteBuf.writeString(this.des);
	    byteBuf.writeInt(this.desTextId);
	    byteBuf.writeString(this.cost);
	    byteBuf.writeBoolean(this.pileUp);
	    byteBuf.writeObject(this.unlockCost);
	    byteBuf.writeObject(this.effect);
	    byteBuf.writeInt(this.belongToRole);
    }
	
	protected RoomCfg readBytes(IByteBuff byteBuf){
	    this.id = byteBuf.readInt(null);
	    this.name = byteBuf.readString(null);
	    this.nameTextId = byteBuf.readInt(null);
	    this.superType = byteBuf.readInt(null);
	    this.subType = byteBuf.readInt(null);
	    this.smallType = byteBuf.readInt(null);
	    this.bagType = byteBuf.readInt(null);
	    this.order = byteBuf.readInt(null);
	    this.star = byteBuf.readInt(null);
	    this.quality = byteBuf.readInt(null);
	    this.sellProfit = (Map)byteBuf.readObject();
	    this.totalMax = byteBuf.readInt(null);
	    this.gridMax = byteBuf.readInt(null);
	    this.convertMax = (Map)byteBuf.readObject();
	    this.dealProfit = (Map)byteBuf.readObject();
	    this.des = byteBuf.readString(null);
	    this.desTextId = byteBuf.readInt(null);
	    this.cost = byteBuf.readString(null);
	    this.pileUp = byteBuf.readBoolean(null);
	    this.unlockCost = (Map)byteBuf.readObject();
	    this.effect = (List)byteBuf.readObject();
	    this.belongToRole = byteBuf.readInt(null);
	    return this;
	}
	
	public RoomCfg deepCopy(){
		RoomCfg roomCfg = null;
		try {
			roomCfg = (RoomCfg) super.clone();
		    roomCfg.sellProfit = ToolCopy.copyObject(this.sellProfit);
		    roomCfg.convertMax = ToolCopy.copyObject(this.convertMax);
		    roomCfg.dealProfit = ToolCopy.copyObject(this.dealProfit);
		    roomCfg.unlockCost = ToolCopy.copyObject(this.unlockCost);
		    roomCfg.effect = ToolCopy.copyObject(this.effect);
			return roomCfg;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return roomCfg;
	}
//自定义内容起始位置
@Override
public Map getUseCast() {
	// TODO Auto-generated method stub
	return null;
}

	@Override
	public Map getUseProfit() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int getOnceUseLimit() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public boolean getAutoUse() {
		return false;
	}
//自定义内容结束位置
}
